//
//  BLTopic.m
//  百思不得姐
//
//  Created by hbl on 16/3/21.
//  Copyright © 2016年 hbl. All rights reserved.
//

#import "BLTopic.h"

@implementation BLTopic
{
    CGFloat _cellHight;
}

- (CGFloat)cellHight
{
    if (!_cellHight) {
        CGSize maxSize = [UIScreen mainScreen].bounds.size;
        NSDictionary *attr = [NSMutableDictionary dictionary];
        attr = @{NSFontAttributeName:[UIFont systemFontOfSize:17.0]};
        CGRect contentTextSize = [self.text boundingRectWithSize:CGSizeMake(maxSize.width - 30, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:attr context:nil];
        CGFloat contentTextY = 60 + contentTextSize.size.height;
        _cellHight =108 + contentTextSize.size.height;
        if ([self.type isEqualToString:@"10"]||[self.type isEqualToString:@"41"] ||[self.type isEqualToString:@"31"]) {
            
            CGFloat imagW = maxSize.width - 30;
            CGFloat imagH = self.height * maxSize.width/self.width;
            if (imagH > 1000) {
                self.picLong = YES;
                imagH = 250;
            }
            self.pictureViewFrame = CGRectMake(10, contentTextY + 5, imagW, imagH);
            _cellHight += imagH + 5;
        }
    }
    return _cellHight;
}



@end
